package com.robot.admin.client;

import com.robot.admin.client.impl.MemberClientImpl;
import com.robot.admin.pojo.client.Member;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-member", fallback = MemberClientImpl.class)
public interface MemberClient {
    /**
     * 会员列表并分页
     *
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "member/third/findMembers/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindMembers(@PathVariable int page, @PathVariable int size);

    /**
     * 通过id查询会员
     *
     * @param id
     * @return
     */
    @GetMapping(value = "member/third/findMemberById/{id}", produces = "application/json; charset=utf-8")
    public String thirdFindMemberById(@PathVariable String id);

    /**
     * 导出下级/我的团队队员列表并分页/邀请人ID是我的全部会员
     *
     * @param id
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "member/third/findMembersByRecommendId/{id}/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindMembersByRecommendId(@PathVariable String id, @PathVariable int page, @PathVariable int size);

    /**
     * 分页+多条件查询
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @PostMapping(value = "member/third/findSearch/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过推荐人名字查询推荐列表
     *
     * @param recommendName
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByRecommendName/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByRecommendName(@RequestBody String recommendName, @PathVariable int page, @PathVariable int size);

    /**
     * 通过推荐人手机号查询推荐列表
     *
     * @param recommendPhone
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "member/third/findMembersByRecommendPhone/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindMembersByRecommendPhone(@RequestBody String recommendPhone, @PathVariable int page, @PathVariable int size);

    /**
     * 传入对象来修改member
     *
     * @param member
     */
    @PutMapping(value = "member/third/updateMemberByMember", produces = "application/json; charset=utf-8")
    @Transactional(rollbackFor = Exception.class)
    public void thirdUpdateMemberByMember(@RequestBody Member member);

    /**
     * 根据isPlus查找今日会员
     *
     * @param isPlus
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByIsPlusAndToday/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByIsPlusAndToday(@RequestBody String isPlus, @PathVariable int page, @PathVariable int size);

    /**
     * 根据isPlus查找昨天会员
     *
     * @param isPlus
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByIsPlusAndYesterday/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByIsPlusAndYesterday(@RequestBody String isPlus, @PathVariable int page, @PathVariable int size);

    /**
     * 根据isPlus查找最近7日会员
     *
     * @param isPlus
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByIsPlusAndWeek/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByIsPlusAndWeek(@RequestBody String isPlus, @PathVariable int page, @PathVariable int size);

    /**
     * 根据isPlus和时间段查找总会员
     * startTime和endTime格式是yyyy-MM-dd即2020-03-01
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByIsPlusAndBetweenAnd/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByIsPlusAndBetweenAnd(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 根据isPlus查找总会员
     *
     * @param isPlus
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "member/third/findMembersByIsPlusAndTotal/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindMembersByIsPlusAndTotal(@RequestBody String isPlus, @PathVariable int page, @PathVariable int size);


    /**
     * 所有反馈并分页
     *
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "feedback/third/findFeedbacksByDeletedAtNullOrderByCreatedAt/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindFeedbacksByDeletedAtNullOrderByCreatedAt(@PathVariable int page, @PathVariable int size);

    /**
     * 某一反馈详情
     *
     * @param id
     * @return
     */
    @GetMapping(value = "feedback/third/findFeedbackById/{id}", produces = "application/json; charset=utf-8")
    public String thirdFindFeedbackById(@PathVariable String id);

    /**
     * 修改反馈详情
     *
     * @param feedback
     * @return
     */
    @RequestMapping(value = "feedback/third/updateFeedback", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateFeedback(@RequestBody String feedback);

    /**
     * 删除某一反馈详情
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "feedback/third/deleteFeedbackById/{id}", produces = "application/json; charset=utf-8")
    public void thirdDeleteFeedbackById(@PathVariable String id);

    /**
     * 软删除
     *
     * @param id
     */
    @PutMapping(value = "feedback/third/updateFeedbackDeletedAtNullById/{id}", produces = "application/json; charset=utf-8")
    public void thirdUpdateFeedbackDeletedAtNullById(@PathVariable String id);

    /**
     * 条件查询AgentApply列表并分页
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "agent_apply/third/search/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindAgentApplyBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 根据id查询AgentApply
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "agent_apply/third/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindAgentApplyById(@PathVariable String id);

    /**
     * 根据id和AgentApply修改AgentApply
     *
     * @param agentApply
     * @param id
     */
    @RequestMapping(value = "agent_apply/third/{id}", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateAgentApplyByAgentApply(@RequestBody String agentApply, @PathVariable String id);

    /**
     * 条件查找merchant_apply列表并分页
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "merchant_apply/third/findMerchantAppliesBySearch/{page}/{size}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantAppliesBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过id查询merchant_apply详情
     *
     * @param id
     * @return
     */
    @GetMapping(value = "merchant_apply/third/findMerchantApplyById/{id}", produces = "application/json; charset=utf-8")
    public String thirdFindMerchantApplyById(@PathVariable String id);

    /**
     * 通过storeId查询merchant_apply详情
     *
     * @param storeId
     * @return
     */
    @GetMapping(value = "merchant_apply/third/findMerchantApplyByStoreId/{storeId}", produces = "application/json; charset=utf-8")
    public String thirdFindTopByStoreIdOrderByCreatedAtDesc(@PathVariable String storeId);

    /**
     * 通过id修改merchant_apply详情
     *
     * @param apply
     * @return
     */
    @RequestMapping(value = "merchant_apply/third/updateMerchantApply", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    @Transactional(rollbackFor = Exception.class)
    public boolean thirdUpdateMerchantApply(@RequestBody String apply);
}
